package com.kingdee.eas.custom.hr.attendance.app;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.basedata.person.PersonFactory;
import com.kingdee.eas.basedata.person.PersonInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.hr.attendance.SpecialOperationLogFactory;
import com.kingdee.eas.custom.hr.attendance.SpecialOperationMgrEntryFactory;
import com.kingdee.eas.custom.hr.attendance.SpecialOperationMgrEntryInfo;
import com.kingdee.eas.hr.base.HRBillBaseEntryInfo;
import com.kingdee.eas.hr.base.HRBillStateEnum;
import com.kingdee.eas.hr.base.app.HRBillBizBean;

public class SpecialOperationMgrBizBean extends HRBillBizBean {

	public void _addnew(Context arg0, IObjectPK arg1, IObjectValue arg2)
			throws BOSException, EASBizException {

	}

	public void _beforeEffectBeforeBackJob(Context arg0,
			HRBillBaseEntryInfo arg1) throws BOSException, EASBizException {
	}

	public void _beforeEffectOnBackJob(Context arg0, HRBillBaseEntryInfo arg1)
			throws BOSException, EASBizException {
	}

	public void _beforeEffectOnNoJob(Context arg0, HRBillBaseEntryInfo arg1)
			throws BOSException, EASBizException {
	}

	public void _check(Context arg0, IObjectPK arg1, IObjectValue arg2)
			throws BOSException, EASBizException {
	}

	public void _delete(Context arg0, IObjectPK arg1) throws BOSException,
			EASBizException {
	}

	public void _entryEffect(Context ctx, HRBillBaseEntryInfo entry)
			throws BOSException, EASBizException {
		SpecialOperationMgrEntryInfo info = SpecialOperationMgrEntryFactory
				.getLocalInstance(ctx).getSpecialOperationMgrEntryInfo(
						new ObjectUuidPK(entry.getId().toString()));
		PersonInfo person = info.getPerson();
		if (person.getId() != null) {
			person = PersonFactory.getLocalInstance(ctx).getPersonInfo(
					new ObjectUuidPK(person.getId().toString()));
			person.setIsSpecialCode(true);
			person.setSpecialOptCancleDate(null);
			person.setSpecialOptStartDate(info.getStartDate());
			PersonFactory.getLocalInstance(ctx).save(person);
		}

		SpecialOperationLogFactory.getLocalInstance(ctx)
				.generateSpecialOperationLog(info);
	}

	public void _processBeforeAddNew(Context arg0, IObjectValue arg1)
			throws BOSException, EASBizException {
	}

	public void _setBillState(Context arg0, BOSUuid arg1, HRBillStateEnum arg2)
			throws BOSException, EASBizException {
	}

	public void _update(Context arg0, IObjectPK arg1, IObjectValue arg2)
			throws BOSException, EASBizException {
	}
}
